package interfazgrafikoak;

import javax.swing.*;
import java.awt.*;
import java.util.*;
public class ZerrendaScrollekin extends JFrame {
  JPanel jPanel1 = new JPanel();
  JList jList1;
  Vector <String> elementuak = new Vector<String>();
  public ZerrendaScrollekin(){
	this.getContentPane().add(jPanel1, null);
    elementuak.addElement("Java");
    elementuak.addElement("Pascal");
    elementuak.addElement("Cobol");
    elementuak.addElement("Perl");
    jList1 = new JList(elementuak);
    jList1.setVisibleRowCount(5);
    JScrollPane j = new JScrollPane(jList1);
    
    //Lista sartzen dugu scroll-a duen panel batean
    jPanel1.add(j,null);
    for (int i=0;i<50;i++) elementuak.addElement("LP "+i);
	pack();
   }
   public static void main(String[] args){
    ZerrendaScrollekin frame = new ZerrendaScrollekin();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }
}